home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / objc / objc-runtime.h < prev    next >
Text File  |  1991-11-26  |  2KB  |  83 lines

  1. /*
  2.  *    objc-runtime.h
  3.  *    Copyright 1988, NeXT, Inc.
  4.  */
  5.  
  6. #ifndef _OBJC_RUNTIME_H_
  7. #define _OBJC_RUNTIME_H_
  8.  
  9. #import <objc/objc.h>
  10. #import <objc/objc-class.h>
  11. #import <objc/hashtable.h>
  12. #import <objc/Object.h>
  13.  
  14. typedef struct objc_symtab *Symtab;
  15.  
  16. struct objc_symtab {
  17.     unsigned long     sel_ref_cnt;
  18.     SEL         *refs;        
  19.     unsigned short     cls_def_cnt;
  20.     unsigned short     cat_def_cnt;
  21.     void          *defs[1];    /* variable size */
  22. };
  23.  
  24. typedef struct objc_module *Module;
  25.  
  26. struct objc_module {
  27.     unsigned long    version;
  28.     unsigned long    size;
  29.     const char    *name;
  30.     Symtab         symtab;    
  31. };
  32.  
  33. struct objc_super {
  34.     id receiver;
  35.     Class class;
  36. };
  37.  
  38. /* kernel operations */
  39.  
  40. extern id objc_getClass(const char *name);
  41. extern id objc_getMetaClass(const char *name);
  42. extern id objc_msgSend(id self, SEL op, ...);
  43. extern id objc_msgSendSuper(struct objc_super *super, SEL op, ...);
  44.  
  45. /* forwarding operations */
  46.  
  47. extern id objc_msgSendv(id self, SEL op, unsigned arg_size, marg_list arg_frame);
  48.  
  49. /* 
  50.    iterating over all the classes in the application...
  51.   
  52.    NXHashTable *class_hash = objc_getClasses();
  53.    NXHashState state = NXInitHashState(class_hash);
  54.    Class class;
  55.   
  56.    while (NXNextHashState(class_hash, &state, &class)
  57.      ...;
  58.  */
  59. extern NXHashTable *objc_getClasses();
  60. extern Module *objc_getModules();
  61. extern id objc_lookUpClass(const char *name);
  62. extern void objc_addClass(Class myClass);
  63.  
  64. /* customizing the error handling for objc_getClass/objc_getMetaClass */
  65.  
  66. extern void objc_setClassHandler(int (*)(const char *));
  67.  
  68. /* Making the Objective-C runtime thread safe. */
  69. extern void objc_setMultithreaded (BOOL flag);
  70.  
  71. /* overriding the default object allocation and error handling routines */
  72.  
  73. extern id    (*_alloc)(Class, unsigned int);
  74. extern id    (*_copy)(Object *, unsigned int);
  75. extern id    (*_realloc)(Object *, unsigned int);
  76. extern id    (*_dealloc)(Object *);
  77. extern id    (*_zoneAlloc)(Class, unsigned int, NXZone *);
  78. extern id    (*_zoneRealloc)(Object *, unsigned int, NXZone *);
  79. extern id    (*_zoneCopy)(Object *, unsigned int, NXZone *);
  80. extern void    (*_error)(Object *, const char *, va_list);
  81.  
  82. #endif /* _OBJC_RUNTIME_H_ */
  83.